import axios from "./index";
export let get = (url, params) => {
  return new Promise((resolve, reject) => {
    return axios.get(url, { params: params })
      .then((res) => {
        // console.log(res);
        return resolve(res);
      })
      .catch((err) => {
        return reject(err);
      });
  });
};
export let post = (url, data) => {
  return new Promise((resolve, reject) => {
    return axios.post(url, data)
      .then((res) => {
        return resolve(res);
      })
      .catch((err) => {
        return reject(err);
      });
  });
};

export let deletes = (url, data) => {
  return new Promise((resolve, reject) => {
    return axios
      .delete(url, data)
      .then((res) => {
        return resolve(res);
      })
      .catch((err) => {
        return reject(err);
      });
  });
};
export let put = (url, data) => {
  return new Promise((resolve, reject) => {
    return axios.put(url, data, {
      headers: {
        'Content-type': 'application/x-www-form-urlencoded'
      }
    })
      .then((res) => {
        return resolve(res);
      })
      .catch((err) => {
        return reject(err);
      });
  });
};
